/*================================================================
*   Copyright (C) 2020 Sangfor Ltd. All rights reserved.
*   
*   文件名称：test.c
*   创 建 者：Ann
*   创建日期：2020年05月24日
*   描    述：
*
================================================================*/

#include <stdio.h>
#include <unistd.h>
#include <signal.h>

struct sigaction oldact;

void sigcb(int signo)
{
    printf("signo = %d\n", signo);
    sigaction(2, &oldact, NULL);
}

typedef struct Data
{
    int a;
    int b;
    int c;
}DATA;

int main()
{
    DATA data;
    data.a = 10;
    data.b = 20;
    data.c = 30;

    printf("a = %d, b = %d, c = %d\n", data.a, data.b, data.c);
    struct sigaction newact;
    newact.sa_handler = sigcb;
    sigemptyset(&newact.sa_mask);
    newact.sa_flags = 0;

    sigaction(2, &newact, &oldact);
    while(1)
    {
        printf("linux-68\n");
        sleep(1);
    }
    return 0;
}
